<!DOCTYPE html><html><head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
     <link rel="stylesheet" type="text/css" href="{$_W['siteroot']}addons/tiger_jifenbao/template/mobile/goods/css/ordinaryRecommend.css">
    <meta name="format-detection" content="telephone=no">
    
	<title>{$goods_info['title']}</title>
    
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="{$_W['siteroot']}addons/tiger_jifenbao/template/mobile/goods/css/normalize.min.css?t=20151016">
<link rel="stylesheet" href="{$_W['siteroot']}addons/tiger_jifenbao/template/mobile/goods/css/modal.min.css">
<link rel="stylesheet" href="{$_W['siteroot']}addons/tiger_jifenbao/template/mobile/goods/css/detail-v12.16.css">
<link type="text/css" rel="stylesheet" href="{$_W['siteroot']}addons/tiger_jifenbao/template/js/sweetalert.css"/>
<script type="text/javascript" src="{$_W['siteroot']}addons/tiger_jifenbao/template/js/sweetalert.min.js"></script>
<script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=mVzo3bHzRIApG1Oi72i3z59Y"></script>
<style>
.powered-logo{width:27px;}
</style>

{if $cfg['szcolor']<>''}
<style>
.theme-color{color: {$cfg['szcolor']};}
.theme-bgcolor{background-color: {$cfg['szcolor']};}
.theme-bordercolor{border-color: {$cfg['szcolor']};}
/* radio */
.radio-group.cur{border-color:{$cfg['szcolor']}; }
.radio-group .cur-arrow{border-color: {$cfg['szcolor']} transparent transparent {$cfg['szcolor']};}
.description a {color: {$cfg['szcolor']};}
</style>
{else}
<style>
.theme-color{color: #ff0000;}
.theme-bgcolor{background-color: #ff0000;}
.theme-bordercolor{border-color: #ff0000;}
/* radio */
.radio-group.cur{border-color:#ff0000; }
.radio-group .cur-arrow{border-color: #55acee transparent transparent #ff0000;}
.description a {color: #ff0000;}
</style>
{/if}
	</head>
<body>
    <div id="db-content" style="padding-bottom: 89px;">
        <div class="db-banner-style">
            <div class="db-banner-swipe" id="swipe" style="visibility: visible;">
                <div>
                    <!-- banner循环开始 -->
                    
                    <a><img src="{php echo (strpos($item['logo'], 'http://') === FALSE) ? $_W['attachurl'].$goods_info['logo'] : $goods_info['logo']}"></a>
                    
                    <!-- banner循环结束 -->
                </div>
            </div>
        </div>
        <header>
            <div class="item-info">
                <div class="left">
                    <h3>{$goods_info['title']}</h3>           	
	                <p>结束时间：{php echo date('Y-m-d H:i:s',$goods_info['endtime'])}</p>
                </div>
                <div class="right">
                    <div class="theme-color"><p>{$goods_info['cost']}</p><span>{if $cfg['hztype']<>''}{$cfg['hztype']}{else}{if $cfg['hztype']<>''}{$cfg['hztype']}{else}积分{/if}{/if}</span></div>
                    <span>￥{$goods_info['price']}元</span>
                </div>
            </div>
            <div class="item-info">
              剩余数量：{$goods_info['amount']}份
            </div>

            {if $goods_info['type'] == 1}
            <div style="width:100%;padding:10px;">
                <p style="width:100%;"><span>姓名：</span><input type="text" name="realname" id="realname" value="{$fans['realname']}" style="border:1px #cccccc solid;height:30px;width:80%;padding-left:5px;" /></p>
            </div>
            <div style="width:100%;padding:10px;">
                <p style="width:100%;"><span>电话：</span><input type="tel" name="mobile" id="mobile" value="{$fans['mobile']}" style="border:1px #cccccc solid;height:30px;width:80%;padding-left:5px;" /></p>
            </div>
            <div style="width:100%;padding:10px;">
                <p style="width:100%;"><span>地址：</span><input type="text" name="residedist" id="residedist" value="{$fans['residedist']}" style="border:1px #cccccc solid;height:30px;width:80%;padding-left:5px;" /></p>
            </div>
			{else if $goods_info['type']== 2}
            <div style="width:100%;padding:10px;">
                <p style="width:100%;"><span>电话：</span><input type="tel" name="mobile" id="mobile" value="{$fans['mobile']}" style="border:1px #cccccc solid;height:30px;width:80%;padding-left:5px;" /></p>
            </div>
            {else if $goods_info['type'] == 0}
            <div style="width:100%;padding:10px;">
                <p style="width:100%;"><span>支付宝：</span><input type="text" name="alipay" id="alipay" value="" style="border:1px #cccccc solid;height:30px;width:80%;padding-left:5px;" /></p>
            </div>
            {/if}
            <div style="width:100%;padding:10px;">
                <p style="width:100%;"><span>备注：</span><input type="text" name="note" id="note" value="" style="border:1px #cccccc solid;height:30px;width:80%;padding-left:5px;" /></p>
            </div>
			
			
			
        </header>
        <section>
        	
            <p class="title">
                <i class="arrow"></i><span>详情说明：</span>
            </p>
            <div class="description">
               {php echo htmlspecialchars_decode($goods_info['content'])}
            </div>
        </section>  
    </div>
    
    <footer>
    	      {if $fans['credit1'] < $goods_info['cost'] }
    		  <div class="level-tip"><i></i><span>您的{if $cfg['hztype']<>''}{$cfg['hztype']}{else}积分{/if}不足</span></div>
              <a href="{$cfg['szurl']}" class="level theme-bgcolor"><span>去赚取更多{if $cfg['hztype']<>''}{$cfg['hztype']}{else}积分{/if}</span><i></i></a>
    		  {elseif  $goods_info['starttime'] > time()}
              <div class="level-tip"><i></i><span>{php echo date('Y-m-d H:i:s',$goods_info['starttime'])}开始</span></div>
              <a href="{$cfg['szurl']}" class="level theme-bgcolor"><span>去赚取更多{if $cfg['hztype']<>''}{$cfg['hztype']}{else}积分{/if}</span><i></i></a>
              {elseif $goods_info['amount'] <= 0 }
              <div class="level-tip"><i></i><span>您来迟了，已经兑换一空</span></div>
              <a href="{$cfg['szurl']}" class="level theme-bgcolor"><span>去赚取更多{if $cfg['hztype']<>''}{$cfg['hztype']}{else}积分{/if}</span><i></i></a>
              {else}
              <button type="button" id="submit" class="submit theme-bgcolor">兑换(消耗{$goods_info['cost']}{if $cfg['hztype']<>''}{$cfg['hztype']}{else}积分{/if})</button>
              {/if}
    		  
    		
    	
    </footer>
    
    <div class="captcha">
        <div class="captcha-dialog">
        </div>
    </div>

<script>
$(function(){
var xddq="{$cfg['locationtype']}";
var gpsdq=localStorage.getItem("getLocation");
var ipdq='{$city}';
var ipprovince='{$province}';
var ipdistrict='{$district}';
var xzdqd='{$cfg["city"]}';
if(xddq==2){
  if(gpsdq.indexOf(ipdq)>-1){
     if(!(xzdqd.indexOf(ipdq)>-1)){
       
        $.ajax({
          url:"{php echo $this->createMobileUrl('ajxdiqu',array('uid'=>$uid))}",
               type:'post',
               data:{
                  province:ipprovince,
                  city:ipdq,
                  district:ipdistrict,
               },
               dataType:"json", 
               success:function(data){
               }
        });
        swal({
            title: "尊敬的粉丝!",
            text: '很抱歉，你不在活动区域',
            type: "warning",    
            html: true,
            timer: 5000000,
            showConfirmButton: false
        });
     }
  }
}

if(xddq==0){
  if(!(xzdqd.indexOf(ipdq)>-1)){
       $.ajax({
          url:"{php echo $this->createMobileUrl('ajxdiqu',array('uid'=>$uid))}",
               type:'post',
               data:{
                  province:ipprovince,
                  city:ipdq,
                  district:ipdistrict,
               },
               dataType:"json", 
               success:function(data){
               }
        });
       swal({
            title: "尊敬的粉丝!",
            text: '很抱歉，你不在活动区域',
            type: "warning",    
            html: true,
            timer: 5000000,
            showConfirmButton: false
        });
     }
}
	
	 //alert(localStorage.getItem("getLocation")+"kk"+"{$cfg["city"]}");
    //非gps定位。则不去抓地址。
	{if empty($cfg["city"]) || empty($cfg["locationtype"])}
       //$(".submit").show();
       //swal('我也要参加活动!')
    {else}
    //地址只抓一次。
 	if (localStorage.getItem("getLocation") && localStorage.getItem("getLocation")=="{$cfg["city"]}"){
	   // alert(localStorage.getItem("getLocation")+"zz"+"{$cfg["city"]}");
		//$(".submit").show();
        //swal('我也要参加活动!');
	 } else { 
         if(xddq==1){
           getLocation(); 
         }	   
	  } 
    {/if}
  
  
 });
  function errorPosition(){
     swal({
            title: "尊敬的粉丝!",
            text: '获取地理位置失败,刷新重试',
            type: "warning",    
            html: true,
            timer: 5000000,
            showConfirmButton: false
        });
	
}
function getLocation(){
    var options={
        enableHighAccuracy:true, 
        maximumAge:1000
    }
   swal({title: "系统加载中",text: "请耐心等待",showConfirmButton: false});
    if(navigator.geolocation){
        //浏览器支持geolocation
        navigator.geolocation.getCurrentPosition(showPosition,errorPosition,options);
        
    }else{
        //浏览器不支持geolocation
    }
}
function errorPosition(error){
	swal({
            title: "尊敬的粉丝!",
            text: '获取地理位置失败,刷新重试,或者你未开启手机微信定位功能',
            type: "warning",    
            html: true,
            timer: 5000000,
            showConfirmButton: false
        });
	
}
function showPosition(position)
{
console.log(position.coords.latitude +
"<br />Longitude: " + position.coords.longitude);

var location= position.coords.latitude+"," + position.coords.longitude;
//alert(location);
/* var point = new BMap.Point(116.331398,39.897445); */

	var point = new BMap.Point(position.coords.longitude,position.coords.latitude);

	var geoc = new BMap.Geocoder(); 
	
	geoc.getLocation(point, function(rs){
		var address = rs.addressComponents;
		//alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
		var diqu="{$cfg["city"]}".split(",");
   	    var str=address.province+","+address.city+","+address.district;
   	    var dw=false;
   	    $.each(diqu, function(i, item){ 
   		     if (str.indexOf(item)>-1) {
   		    	 dw=true;
   		    	 $(".submit").show();
   				 localStorage.setItem("getLocation", "{$cfg["city"]}"); 
                 return false;
   		     }  
   		 }); 
   	  if (dw==false) {
      		swal({
            title: "尊敬的粉丝!",
            text: '很抱歉，你不在活动区域',
            type: "warning",    
            html: true,
            timer: 5000000,
            showConfirmButton: false
        });
   	  }	  else {
		  swal("", "验证成功，可以兑换奖品", "success");
	  }
   	 
   		return;
   	});
	return;
//百度接口，一天可以调用100w次，此处注释。
var url="http://api.map.baidu.com/geocoder/v2/"+
 "?ak=mVzo3bHzRIApG1Oi72i3z59Y&callback=renderReverse&location="+location+"&output=json&pois=0";
$.ajax({
      type : "get",
      async:false,
      url : url,
      dataType : "jsonp",
      jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
      jsonpCallback:"renderReverse",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
      success : function(json){
          if (json.status=="0"){
           	  var address=json.result.addressComponent;
        	  var diqu="{$cfg["city"]}".split(",");
        	  var str=address.province+","+address.city+","+address.district;
        	  var dw=false;
        	  $.each(diqu, function(i, item){ 
        		     if (str.indexOf(item)>-1) {
        		    	 dw=true;
        		    	 $(".submit").show();
        				 localStorage.setItem("getLocation", "{$cfg["city"]}"); 
                         return false;
        		     }  
        		 }); 
        	  if (dw==false) {
           		swal({
                    title: "尊敬的粉丝!",
                    text: '很抱歉，你不在活动区域',
                    type: "warning",    
                    html: true,
                    timer: 5000000,
                    showConfirmButton: false
                });
        		return;
        	    //$(".layer").fadeIn();
                //$(".layer-city").fadeIn();
                //$("#citydesc").text(str);
                swal('很抱歉!!!,您所在的区域不能参加此活动');
        	  } else {
        		  swal("", "验证成功，可以兑换奖品", "success");
        	  }
        	
          } else {
        	  alert("获取定位失败");
        }
      },
      error:function(){
          alert('fail');
      }
  });

}
</script>

<script type="text/javascript">   
$(document).ready(function(){ 
      $(".submit").click(function(){
      
         {if $goods_info['type'] == 1}
            if ($('#realname').val()=='') {
                swal('请输入您的姓名');
                return false;
            }
            if ($('#mobile').val()=='') {
                swal('请输入您的手机号码');
                return false;
            }
            if (!/^1[0-9]{10}/.test($('#mobile').val())) {
                swal('请输入正确的手机号码');
                return false;
            }
            if (!$('#residedist').val()) {
                    swal('请输入您的邮寄地址！');
					return false;
				}

         {else if $goods_info['type']== 2}
            if ($('#mobile').val()=='') {
                swal('请输入您的手机号码');
                return false;
            }
            if (!/^1[0-9]{10}/.test($('#mobile').val())) {
                swal('请输入正确的手机号码');
                return false;
            }

         {else if $goods_info['type'] == 0}
           if (!$('#alipay').val()) {
                    swal('请输入您的支付宝！');
					return false;
				}
         {/if}
        

        $("#submit").html("提交中请稍候……");
        $.ajax({
          url:"{php echo $this->createMobileUrl('Goodpost')}",
          type:'post',
          data:{
             goods_id:"{$goods_id}",
             weid:"{$_W['weid']}",
             realname:$('#realname').val(),
             mobile:$('#mobile').val(),
             typea:"{$goods_info['type']}",
             memberid:"{$memberid}",
             residedist:$('#residedist').val(),
             alipay:$('#alipay').val(),
             note:$('#note').val(),             
          },
          dataType:"json", 
          success:function(data){
            if(data.success==true){
                $("#dis").css("display", "none");
                    swal({
                        title: "兑换成功",
                        text: data.msg,
                        type: "success",
                        showCancelButton: false,
                        closeOnConfirm: false,
                        confirmButtonText: "查看已兑换奖品",
                        confirmButtonColor: "#ec6c62"
                    }, function() {                      
                        location.href ="{php echo $this->createMobileUrl('request')}";                      
                    });

            }else{
              //swal(data.msg);
              swal({
                    title: "尊敬的粉丝!",
                    text: data.msg,
                    type: "warning",    
                    html: true,
                    timer: 5000000,
                    showConfirmButton: false
                });
            }
          }
        });

        
      });
});
</script>
</body>
</html>